//
//  SignUpPage.swift
//  SignUp
//
//  Created by 王友俊 on 16/1/21.
//  Copyright © 2016年 wangyj. All rights reserved.
//

import UIKit

class SignUpPage: UIViewController,UIImagePickerControllerDelegate,UINavigationControllerDelegate {

    @IBOutlet weak var userImage: UIImageView!
    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    
    @IBAction func cancelButton(sender: AnyObject) {
        //销毁当前注册界面返回之前的页面
        self.dismissViewControllerAnimated(true, completion: nil)
    }
    
    @IBAction func selectPhotoButton(sender: AnyObject) {
        let pickerControler = UIImagePickerController()
        pickerControler.delegate = self
        pickerControler.sourceType = UIImagePickerControllerSourceType.PhotoLibrary
        self.presentViewController(pickerControler, animated: true, completion: nil)
    }
    
    func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : AnyObject]) {
        userImage.image = info[UIImagePickerControllerOriginalImage] as? UIImage//之前的照片  info字典数组
        self.dismissViewControllerAnimated(true, completion: nil)//清除照片
    }

}
